package game.view;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;

import accessory.CLog;

import map.PlayerObject;

public class RosterView {
	
	private static final int ROSTER_ACTIVE_CELL_HEIGHT = 300;
	private static final int ROSTER_CELL_HEIGHT = 80;
	private static final int CELL_OFFSET = 20;
	private static final int ROSTER_CELL_WIDTH = 115;
	
	private boolean rosterActive;
	
	public RosterView(){
		rosterActive = false;
	}
	
	public void setActive(boolean val){
		this.rosterActive  = val;
		CLog.info("Roster state: "+val);
	}
	
	public boolean isActive(){
		return rosterActive;
	}
	
	public void loadRoster(PlayerObject playOb){
		playOb.getRoster();
	}
	
	public void renderFrame(Graphics arg0, int width, int height){
		if(rosterActive){
			Graphics2D g2d = (Graphics2D)arg0;
			
		    GradientPaint gp = new GradientPaint( 0f, 0, Color.BLACK, width, height, new Color(72, 74, 73));
		    g2d.setPaint(gp);
		    g2d.fillRect(0,0, width, height);
		    
		    
	    	GradientPaint gpbox = new GradientPaint( 0f, 0, new Color(69,73,84), width, height, new Color(33, 29, 30));
		    g2d.setPaint(gpbox);
		    
		    int offset = 20;
		    for(int i = 0; i < 6; i++){
			    g2d.drawRect(offset, CELL_OFFSET, ROSTER_CELL_WIDTH, ROSTER_ACTIVE_CELL_HEIGHT);
			    offset += (ROSTER_CELL_WIDTH+CELL_OFFSET);
		    }
		    
		    int offset2 = 20;
		    
		    
		    for (int i = 0; i < 8; i++) {
		    	int yoffset = ROSTER_ACTIVE_CELL_HEIGHT + CELL_OFFSET*2;
				for (int j = 0; j < 4; j++) {
				    g2d.drawRect(offset2, yoffset, ROSTER_CELL_WIDTH, ROSTER_ACTIVE_CELL_HEIGHT);
				    yoffset += (ROSTER_CELL_HEIGHT+CELL_OFFSET);
				}
				offset2 += (ROSTER_CELL_WIDTH+CELL_OFFSET);
			}
		    
		}
	}
	

}
